package com.example.customview.progressview

import com.alibaba.android.arouter.facade.annotation.Route
import com.android.baselibrary.base.BaseFragment
import com.example.customview.R
import com.example.customview.arouter.CustomArouter
import com.example.customview.databinding.FragmentProgressviewBinding
import kotlinx.coroutines.*

@Route(path = CustomArouter.CUSTOM_PROGRESS_VIEW)
class ProgressViewFragment:BaseFragment<FragmentProgressviewBinding>() {
    private var percent = 0.1
    override fun getLayoutID() = R.layout.fragment_progressview

    override fun initView() {
        GlobalScope.launch {
            for(i in  0 until 10){
                delay(1000)
                withContext(Dispatchers.Main){
                    percent += 0.1
                    mBinding.progressView.start(percent)
                }

            }
        }
    }
}